<template>
  <el-dialog :title="title"
             :visible.sync="dialogData.show"
             center
             @close="$emit('closedialog')"
             width="700px">
    <el-form :model="form"
             label-position="right"
             label-width="150px">

      <el-form-item label="预约人：">
        <p style='width:150px'>{{form.nickName}}</p>
      </el-form-item>
      <el-form-item label="手机号：">
        <p style='width:150px'>{{form.loginName}}</p>
      </el-form-item>
      <el-form-item label="申请时间：">
        <p style='width:150px'>{{commonFunction.timestampFormat(new Date(form.createTime), 'yyyy-MM-dd hh:mm:ss')}}</p>
      </el-form-item>

      <el-form-item label="面诊人姓名：">
        <p style='width:150px'>{{form.memberName}}</p>
      </el-form-item>
      <el-form-item label="面诊人性别：">
        <p style='width:150px'>{{form.sex == 1 ?'男':'女'}}</p>
      </el-form-item>
      <el-form-item label="面诊人电话：">
        <p style='width:150px'>{{form.memberPhone}}</p>
      </el-form-item>
      <el-form-item label="面诊人身份证号：">
        <p style='width:150px'>{{form.idCard}}</p>
      </el-form-item>
      <el-form-item label="预约时间：">
        <p style='width:150px'>{{form.reserveDate}}</p>
      </el-form-item>
      <el-form-item label="预约医生姓名：">
        <p style='width:150px'>{{form.doctorName}}</p>
      </el-form-item>
      <el-form-item label="预约医生职级：">
        <p style='width:150px'>{{form.doctorTitleName}}</p>
      </el-form-item>
      <el-form-item label="预约医生科室：">
        <p style='width:150px'>{{form.departmentName}}</p>
      </el-form-item>
      <el-form-item label="预约医生挂号费：">
        <p style='width:150px'>{{form.price}}</p>
      </el-form-item>
      <el-form-item label="预约医生所在医院：">
        <p style='width:150px'>{{form.hospitalName}}</p>
      </el-form-item>
      <el-form-item label="预约结果："
                    v-if="dialogData.reserveStatus == 1">
        <el-radio-group v-model="radio">
          <el-radio :label="2">成功</el-radio>
          <el-radio :label="3">失败</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="预约结果："
                    v-if="dialogData.reserveStatus != 1">
        <p>{{dialogData.reserveStatus == 1?'待预约':dialogData.reserveStatus == 2?'预约成功':dialogData.reserveStatus == 3?'预约失败':'取消预约'}}</p>
      </el-form-item>
      <el-form-item label="确认时间："
                    v-if="dialogData.reserveStatus == 2">
        <p>{{commonFunction.timestampFormat(new Date(form.lastUpdateTime), 'yyyy-MM-dd hh:mm:ss')}}</p>
      </el-form-item>
    </el-form>
    <div slot="footer"
         class="dialog-footer">
      <el-button @click="$emit('closedialog')">返 回</el-button>
      <el-button type="success"
                 v-if="dialogData.reserveStatus == 1"
                 style="background-color:#33c99e;color:#FFF"
                 @click="addone">提 交</el-button>

    </div>
  </el-dialog>
</template>

<script>
  export default {
    props: ['dialogData'],
    data () {
      return {
        form: {},
        radio: '',
        title: '面诊订单详情'
      }
    },
    methods: {
      addone () {
        this.post(this.api.cooperationHospital.uploadReserveStatus, { "id": this.dialogData.id, reserveStatus: this.radio }).then((res) => {
          if (res.data.code === '200') {
            this.$message.success('操作成功')
            this.$emit('closedialog')
          } else {
            this.$message.warning(res.data.message)
          }
        });
      }
    },
    mounted () {
      this.post(this.api.cooperationHospital.faceConsultationgetDetail, { "id": this.dialogData.id }).then((res) => {
        this.form = res.data.object
      });

    }
  };
</script>

<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409eff;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
